<?php
require("include/db.php");
require("include/head.php");
?>
<?php
$sqla   = "select * from member where username='".$_POST["username"]."'";
$conn = getconnection();
$result = mysql_query($sqla, $conn);
$rows   = mysql_num_rows($result);
if   ($rows   !=   0)
{
	echo "Sorry,User name exited";
	echo "Please select an other username";
	echo "<a href=\"membersignup.php\">Resignup</a>";
}
else
{
	if ($_POST["password"]!=$_POST["confirmpassword"])
	{
		echo "password and confirmpassword is not match";
	}
	else
	{
		$birthday=date("Y-m-d" , mktime(0,0,0,$_POST["birthday_day"],$_POST["birthday_mon"],$_POST["birthday_yr"]));
		$sql = "insert into member(username,email,password,city,birthday,gender) values('".$_POST["username"]."','".$_POST["email"]."','".$_POST["password"]."','".$_POST["city"]."','$birthday','".$_POST["gender"]."')";
		$res = mysql_query($sql, $conn);
		$err = mysql_error();
		if($err)
		{
			echo "add member error ".$err;
		}
		else
		{
			echo "<h1>Congratulate,Create member account succesful!</h1>";
		}
	}
}
mysql_close($conn);
?> 
<?php
include "include/foot.php";
?>